# -*- coding:utf-8 -*-
# 
"""
题目url: https://leetcode-cn.com/problems/longest-palindromic-substring/
描述：
    给定一个字符串 s，找到 s 中最长的回文子串。你可以假设 s 的最大长度为 1000。
"""
class Solution:
    
    def longestPalindrome(self, s: str):
        s_len = len(s)
        res = str()
        for i in range(s_len):
            sum1 = str()
            sum2 = str()
            for s1 in s[i:]:
                sum1 = sum1 + s1
                sum2 = s1 + sum2
                if sum1 == sum2 and len(sum1) > len(res):
                    res = sum1
                else:
                    continue
        return res

        
res = Solution().longestPalindrome("bcbcd")
print(res)

